Skip to content

Instantly share code, notes, and snippets.

@karpathy
karpathy / microgpt.py
Last active February 11, 2026 23:05
microgpt
"""
The most atomic way to train and inference a GPT LLM in pure, dependency-free Python.
Differences from GPT-2 are minor: rmsnorm instead of layer norm, no biases, square ReLU instead of GeLU nonlinearity, no weight tying.
The contents of this file is everything algorithmically needed to train a GPT. Everything else is just efficiency.
Art project by @karpathy.
"""
import os # for os.path.exists
import math # for math.log, math.exp
import random # for random.seed, random.choices
" Wez's VIM colors for Dark background
" vim:ts=2:sw=2:et:
hi clear
if exists("syntax on")
syntax reset
endif
let g:colors_name = "wez"
let &background="dark"
@rafaelrocha007
rafaelrocha007 / engineering-ai-guidelines.md
Last active February 11, 2026 22:59
Engineering AI Guidelines: Uso consciente e eficiente de IA usando IDEs como o Cursor e Antigravity

Guia de uso consciente e eficiente de IA na engenharia de software

Objetivo

Este guia estabelece boas práticas para uso de LLMs (ChatGPT, Claude, Gemini, etc.) e ferramentas como Cursor IDE na engenharia de software.

O objetivo é:

  • Reduzir custo
  • Aumentar assertividade
@MabezDev
MabezDev / 1.md
Last active February 11, 2026 22:59
Create a 16bit R5G6B5 raw image for embedded displays.
  • Import your image or create image with GIMP.

  • Export as bmp -> advanced options -> 16bit

  • Then to get the raw bytes run tail -c $bytes image.bmp > image.raw where $bytes is w * h * 2 of the image. This removes the BMP header.

@pwillis-els
pwillis-els / Simple_Atomic_File_Locking_Linux.md
Last active February 11, 2026 22:58
Simple Atomic File Locking in Linux

Simple Atomic File Locking in Linux

If you have access to a traditional programming language, there are many methods1 to use2 locks in linux3. However, we don't necessarily have access to those methods within a shell script. In addition, using locks over different kinds of filesystems (such as NFS) can also have inconsistencies and bugs.

What if you just want a very simple form of locking that works on all filesystems? The answer is Maildir locking. The way Qmail / Maildir works is specific to mail files, so I'll break it down in a more general way below. You also don't have to strictly follow this method; the general idea can be modified.